package offer;

import java.util.Arrays;

public class offer_0040 {
    public int[] getLeastNumbers(int[] arr, int k) {
        Arrays.sort(arr);
        if(k>arr.length) k=arr.length;
        int[] result=new int[k];
        for(int i=0;i<k;++i){
            result[i]=arr[i];
        }
        return result;
    }
}
